<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "article".
 *
 * @property integer $article_id
 * @property integer $cat_id
 * @property string $title
 * @property integer $user_id
 * @property string $keywords
 * @property integer $article_type
 * @property integer $status
 * @property string $cover
 * @property string $description
 * @property integer $add_time
 * @property integer $update_time
 * @property string $source
 */
class Article extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'article';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['cat_id', 'user_id', 'article_type', 'status', 'add_time', 'update_time'], 'integer'],
            [['title', 'user_id', 'keywords', 'article_type', 'status'], 'required'],
            [['title'], 'string', 'max' => 180],
            [['keywords', 'cover', 'description', 'source'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'article_id' => '文章ID',
            'cat_id' => '分类',
            'title' => '文章标题',
            'user_id' => '用户ID',
            'keywords' => '关键字',
            'article_type' => '文章类型',
            'status' => '状态',
            'cover' => '封面图',
            'description' => '描述',
            'add_time' => '添加时间',
            'update_time' => '更新时间',
            'source' => '缩略图',
        ];
    }
}
